//app.js
var help = require('./utils/help.js');
App({
  data: {
    imageUrl: 'https://www.guangxishanmei.com/assets/wechat/',
    apiUrl: 'https://www.guangxishanmei.com/index.php/api/',
    // imageUrl: 'http://shanmei.test/assets/wechat/',
    // apiUrl: 'http://shanmei.test/index.php/api/',
    userInfo: null, // 用户信息
    wxUserInfo: null, // 微信用户信息
    location: { lat: 0, lng: 0 }, // 位置
    location_data: null, // 位置
    mobile: '',
    session_key: '',
    openid: '',
    getPhoneNumber: {},
    dingshiqi: null,
    dingshiqi22: null,
    config: {
      is_show_video: 0,
    }
  },
  onLaunch: function () {
    var that = this;
    this.data.userInfo = wx.getStorageSync('userInfo') || null;
    this.data.wxUserInfo = wx.getStorageSync('wxUserInfo') || null;
    this.data.location = wx.getStorageSync('location') || { lat: 0, lng: 0 };
    this.data.location_data = wx.getStorageSync('location_data') || null;

  },
  getConfig: function (page) {
    var that = this;
    help.get(that.data.apiUrl + 'Index/getConfig', {}, that, function (res, that) {
      var result = res.data;
      // console.log(result);
      if (result.code == 1) {
        that.data.config = result.data;
        page.setData({
          config: result.data
        })
      }
    });
  }
})